﻿// <copyright file="StreamInfo.cs" company="Microsoft Corporation">
// Copyright (c) 2009 Microsoft Corporation All Rights Reserved
// </copyright>
// <author>Michael S. Scherotter</author>
// <email>mischero@microsoft.com</email>
// <date>2009-11-27</date>
// <summary>StreamInfo class definition</summary>

namespace Microsoft.WebAnalytics.Data
{
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.Runtime.Serialization;

    /// <summary>
    /// Stream info serialization
    /// </summary>
    [DataContract]
    public class StreamInfo
    {
        /// <summary>
        /// Initializes a new instance of the StreamInfo class
        /// </summary>
        public StreamInfo()
        {
            this.AvailableTracks = new Collection<TrackInfo>();
            this.ChildStreams = new Collection<StreamInfo>();
            this.CustomAttributes = new Dictionary<string, string>();
            this.SelectedTracks = new Collection<TrackInfo>();
            this.Tracks = new Collection<TrackInfo>();
        }

        /// <summary>
        /// Gets or sets the available tracks
        /// </summary>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly", Justification = "Necessary for XAML serialization."), DataMember]
        public Collection<TrackInfo> AvailableTracks { get; set; }

        /// <summary>
        /// Gets or sets a child stream
        /// </summary>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly", Justification = "Necessary for XAML serialization."), DataMember]
        public Collection<StreamInfo> ChildStreams { get; set; }

        /// <summary>
        /// Gets or sets the custom attributes
        /// </summary>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly", Justification = "Necessary for XAML serialization."), DataMember]
        public Dictionary<string, string> CustomAttributes { get; set; }

        /// <summary>
        /// Gets or sets the stream duration
        /// </summary>
        [DataMember]
        public virtual long Duration { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether the stream is enabled
        /// </summary>
        [DataMember]
        public virtual bool Enabled { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether the stream is sparse
        /// </summary>
        [DataMember]
        public bool IsSparseStream { get; set; }

        /// <summary>
        /// Gets or sets the name of the stream
        /// </summary>
        [DataMember]
        public string Name { get; set; }

        /// <summary>
        /// Gets or sets the selected tracks
        /// </summary>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly", Justification = "Necessary for XAML serialization."), DataMember]
        public Collection<TrackInfo> SelectedTracks { get; set; }

        /// <summary>
        /// Gets or sets the subtype
        /// </summary>
        [DataMember]
        public string Subtype { get; set; }

        /// <summary>
        /// Gets or sets the time scale
        /// </summary>
        [DataMember(Name = "TS", EmitDefaultValue = false, IsRequired = false)]
        public long Timescale { get; set; }

        /// <summary>
        /// Gets or sets the collection of tracks
        /// </summary>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly", Justification = "Necessary for XAML serialization."), DataMember]
        public Collection<TrackInfo> Tracks { get; set; }

        /// <summary>
        /// Gets or sets the stream type
        /// </summary>
        [DataMember]
        public string StreamType { get; set; }

        /// <summary>
        /// Gets or sets the stream URL
        /// </summary>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings", Justification = "This might be a fragment"), DataMember]
        public string Url { get;  set; }
    }
}
